#include "main/utils.h"
using namespace std;

class Solution {
public:
    int maximumProduct(vector<int>& nums, int k) {
      priority_queue<int, vector<int>, greater<int>> queue;
      for (auto num : nums) {
        queue.push(num);
      }
      for (int i = 0; i < k; ++i) {
        int num = queue.top();
        queue.pop();
        queue.push(num + 1);
      }
      int max_product = 1;
      int mod = 1000000007;
      while (!queue.empty()) {
        max_product = (long long)(queue.top()) * max_product % mod;
        queue.pop();
      }
      return max_product;
    }
};

int main() {
  vector<int> nums = {6, 3, 3, 2};
  int k = 2;
  Solution su;
  cout << su.maximumProduct(nums, k) << endl;

  return 0;
}
